/*
 * @Author: Yejing
 * @Date: 2023-05-30 09:22:28
 * @LastEditors: Yejing
 * @LastEditTime: 2023-05-30 09:23:00
 * @Description: 基础模态框
 */
<template>
	<view>
		<u-modal v-model="showModal" :title="title" :confirm-text="confirmText" :cancel-text="cancelText" :content='content'
			:showCancelButton='showCancelButton' :showConfirmButton='showConfirmButton' @cancel='cancelClick'
			@confirm='confirmClick'></u-modal>
	</view>
</template>

<script>
	export default {
		name: "modal",
		props: {
			//模态款显示状态
			show: {
				type: Boolean,
				default: false
			},
			//标题
			title: {
				type: String,
				default: null
			},
			//取消按钮文字
			cancelText: {
				type: String,
				default () {
					return this.$t('system.cancel')
				}
			},
			//确认按钮文字
			confirmText: {
				type: String,
				default () {
					return this.$t('system.affirm')
				}
			},
			//内容
			content: {
				type: String,
				default: null
			},
			//取消按钮显示状态
			showCancelButton: {
				type: Boolean,
				default: true
			},
			//确认按钮显示状态
			showConfirmButton: {
				type: Boolean,
				default: true
			}

		},
		//监听显示状态
		watch: {
			show(val) {
				this.showModal = val
			}
		},
		data() {
			return {
				showModal: undefined
			};
		},
		methods: {
			//取消按钮
			cancelClick() {
				this.$emit('cancelClick')
			},
			//确认按钮
			confirmClick() {
				this.$emit('confirmClick')
			}

		}
	}
</script>

<style>

</style>